home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / ViewIt™ Shareware.sea / ViewIt™ 2.04 Shareware / FaceWare.rsrc / TEXT_1263_V12. Odds & Ends.txt < prev    next >
Text File  |  1992-08-15  |  3KB  |  26 lines

  1. V12. Odds & Ends
  2.  
  3. INIT Problems
  4.   In 1990 we wrote:  "The interaction between programs, INITs, new System Software, and new versions of the Mac seems to be getting increasingly unstable.  When all else fails, try removing an INIT!"  This advice continues to be true, especially with the new Macintosh Quadra.
  5.  
  6. Clobbered Variables
  7.   A common problem encounterd by programmers new to FaceWare occurs when they forget that most fRec variables are scratch variables that can be changed by any call to the FaceIt dispatching procedure or to the Control Manager (since the Control Manager calls ViewIt via CDEF 1200).  The scratch variables include all those prefixed by letters "u", "w", or "c".  The rule of thumb to follow is that if you will be using such an fRec variable in more than one FaceIt or Control Manager call, then save a copy of its contents in a local variable and use the copy.  (Exceptions:  Most UtilIt commands and utility-type modules preserve the "w" and "c" variables.)
  8.   Suppose, for example, that a control handle is needed for use in a single call to SizeControl.  In this case you can get away with using cControl:
  9.  FaceIt(nil,GetCtl,1030,0,1,5);
  10.  SizeControl(fRec.cControl,100,100);
  11. But if the control handle is also used in a subsequent call, then a copy of cControl should be used:
  12.  FaceIt(nil,GetCtl,1030,0,1,5);
  13.  theControl := fRec.cControl;
  14.  SizeControl(theControl,100,100);
  15.  FaceIt(nil,AddCtl,1004,0,ord(theControl),0);
  16. since both the Control Manager and FaceIt calls can result in clobbering the current values in fRec.
  17.   The same precaution should be taken with commonly used variables such as uString, uMenuID, uMenuItem, wvHit, and wcHit, although these are most often used as simple case selectors in case blocks in a way that does not require their contents to be saved.
  18.  
  19. Program Drawing
  20.   Any drawing that a main program does with QuickDraw always occurs within the current port.  If using FaceIt, the current port will almost always be the active window since FaceIt sets the port to the active window whenever DoLoop is called.  If you need to draw into a window that is not the active window, then call SetPort to first reset the current port to that window.  This should also be done before using calls such as GlobalToLocal and LocalToGlobal since these are a function of the current port.  (If drawing from within a control driver or override procedure, then you don't have to worry about this since the current port is always reset to the port containing the control before a driver is called.)
  21.  
  22. The Help Key
  23.   The "help" key (ASCII 5) on Mac keyboards is converted by ViewIt to the command key combination "‚åò/".  To use a different command key for "help", change the first string in STR# 1203 from "/" to some other character.
  24.  
  25. Spurious Events
  26.   The FaceIt dispatching procedure contains a FlushEvents call that removes all key and mouse events from the event queue the first time FaceIt is called.  Another use of this toolbox call is to clear any spurious key and mouse events that occur during execution of a time-consuming routine within the main program.  Simply insert a FlushEvents call after such a routine to prevent any accumulated mouse or key events in the event queue from being processed "all at once" when control is returned to FaceIt.